import 'dart:ui';

import 'package:fish_redux/fish_redux.dart';
import 'package:flutter/cupertino.dart';
import 'package:www.znpigai.teacher/home_page/subject_tab_component/item/state.dart';

import '../global_store/state.dart';

class HomeworkPostState
    implements GlobalBaseState, Cloneable<HomeworkPostState> {
  PageController controller = PageController();
  List<String> selectClasses = [];
  String title = '';
  String demand = '';
  String ideation = ''; // 构思点拨
  String keywords = ''; // 空格分隔中心词
  String type = 'type1'; // 作文体裁

  DateTime start = DateTime.now();
  DateTime end = DateTime.now().add(Duration(days: 7));
  double minCount = 10;
  double maxCount = 20;
  double minScore = 0;
  double maxScore = 0;
  double passScore = 0;

  @override
  HomeworkPostState clone() {
    return HomeworkPostState()
      ..themeColor = themeColor
      ..userInfo = userInfo
      ..controller = controller
      ..selectClasses = selectClasses
      ..type = type
      ..title = title
      ..demand = demand
      ..ideation = ideation
      ..keywords = keywords
      ..start = start
      ..end = end
      ..minCount = minCount
      ..maxCount = maxCount
      ..minScore = minScore
      ..maxScore = maxScore
      ..passScore = passScore;
  }

  @override
  Color themeColor;

  @override
  Map<String, dynamic> userInfo;
}

HomeworkPostState initPostState(SubjectState args) {
  var state = HomeworkPostState();
  if (args != null) {
    state
      ..ideation = args.ideation
      ..demand = args.demand
      ..title = args.title
      ..keywords = args.keywordList.join(' ');
  }
  return state;
}
